package cn.ncupyh;

import java.time.*;
import java.time.format.DateTimeFormatter;

public class JAVAData8 {
        public static boolean isMondayToFriday() {
            LocalDateTime now = LocalDateTime.now();
            DayOfWeek dayOfWeek = now.getDayOfWeek();
            System.out.println(dayOfWeek);
            if (dayOfWeek != DayOfWeek.SATURDAY && dayOfWeek != DayOfWeek.SUNDAY)
                return true;
            return false;
        }

        public static void main(String[] args) {
            LocalTime localTime = LocalTime.of(0, 0,0);
            System.out.println(localTime);//当地时间设置
            LocalDate localDate = LocalDate.of(1998, 10, 31);
            System.out.println(localDate);//当地日期设置好
            ZonedDateTime zonedDateTime = ZonedDateTime.of(localDate,localTime,ZoneId.of("Asia/Shanghai"));
            System.out.println(zonedDateTime);//地区的日期-时间设置

//            System.out.println(zonedDateTime.toEpochSecond());
//            System.out.println(zonedDateTime.toInstant());
//            System.out.println(zonedDateTime.toInstant().toEpochMilli());

            System.out.println(LocalTime.now());//现在时间
            System.out.println(LocalDate.now());//现在日期
            System.out.println(LocalDateTime.now());//现在的日期时间
            LocalDate nowDate = LocalDate.now();
            LocalTime nowTime = LocalTime.now();
            System.out.println(OffsetDateTime.of(nowDate, nowTime, ZoneOffset.UTC));//现在的日期时间
            System.out.println(OffsetDateTime.now().toEpochSecond());//1681997172--------------------------------------

            System.out.println("Year, YearMonth, Month, MonthDay");

            System.out.println("TemporalAmount");
            String pattern = "E MM/dd/yyyy";
            System.out.println(LocalDate.of(1989, 9, 22).plusDays(5).plusMonths(6).plusWeeks(3).format(DateTimeFormatter.ofPattern(pattern)));

            System.out.println(isMondayToFriday());//判断是否为周一至周五

            Duration thirtyDay = Duration.ofDays(30);
            System.out.println(thirtyDay.toString());//PT720H


        }
    }



